package JavaSE.d3;

import java.util.Scanner;

/*
在数组中查找单词
定义一个长度为 10 的一维字符串数组，在每一个元素存放一个单词；
然后运行时从命令行输入一个单词，程序判断数组是否包含有这个单词，包含这个单词就打印出“Yes”，不包含就打印出“No”
 */
public class Test13 {
    public static void main(String[] args) {
        String c[]={"hellow","we","are","student","i","hope","you","can","happy","and"};
        System.out.println("请输入单词");
        Scanner scanner = new Scanner(System.in);
        String select=scanner.nextLine();
        int n=0;
        for (String s : c) {
            if(s.equals(select)){
                n++;
                System.out.println("YES");
            }
        }
        if(n==0){
            System.out.println("NO");
        }
    }
}
